﻿using System;
using Microsoft.SharePoint.WebControls;

namespace Navigant.Web.UI
{
    public class GroupableSPGridView : SPGridView
    {
        public event EventHandler RequiresDataSource;

        protected override void LoadControlState(object savedState)
        {
            base.LoadControlState(savedState);
            if (this.DataSource == null)
            {
                this.InvokeRequiresDataSource();
            }
        }

        protected void InvokeRequiresDataSource()
        {
            EventHandler handler = this.RequiresDataSource;
            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }
    }
}
